package com.example.zzm.yuejian03.Activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.RelativeLayout;

import com.example.zzm.yuejian03.R;

public class firstActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //getSupportActionBar().hide();
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//AS下全屏隐藏标题栏代码
        setContentView(R.layout.first);
        RelativeLayout laoutsplsh=findViewById(R.id.activity_splash);
        AlphaAnimation alphaAnimation =new AlphaAnimation(0.1f,1.0f);
        alphaAnimation.setDuration(2200);
        laoutsplsh.startAnimation(alphaAnimation);
        alphaAnimation.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {
                Intent intent=new Intent(firstActivity.this,LoginActivity.class);
                intent.setClass(getApplicationContext(),LoginActivity.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
                //把那个MainActivity设置为栈底    意思就是防止你按返回键的时候返回到哪个启动欢迎界面

                startActivity(intent);//载入主窗口

            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });

    }
}
